<template>
	<view class="settle-container">
		<label class="radio" @click="changeAllState">
		  <radio :checked='isFull' color='#c00000' /><text>全选</text>
		</label>
    
    <view class="amount">
      合计:<text>￥{{amount | toFixed}}</text>
    </view>
    
    <view class="btn-settle">
      结算({{checkedCount}})
    </view>
	</view>
</template>

<script>
  import {mapState,mapGetters,mapMutations} from 'vuex'
	export default {
    computed:{
      ...mapGetters('m_cart',['total','amount','checkedCount']),
      isFull(){
        return this.total === this.checkedCount
      }
    },
    filters: {
      toFixed(num){
        return Number(num).toFixed(2)
      }
    },
		data() {
			return {
				
			};
		},
      
    methods:{
      ...mapMutations('m_cart',['updateAllState']),
      
      changeAllState(){
        this.updateAllState(!this.isFull)
      }
    }
	}
</script>

<style lang="scss">
.settle-container{
  position: sticky;
  left: 0;
  bottom: 0;
  z-index: 999;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 10px;
  height: 50px;
  
  .amount{
    text{
      color: #c00000;
    }
  }
  
  .btn-settle{
    background-color: #c00000;
    text-align: center;
    line-height: 50px;
    color: #FFFFFF;
    height: 50px;
    width: 100px;
  }
}
</style>
